.switch-name {
  --dark-sky: rgba(255,255,255,.3);
  --moon: #212121;
  --light-sky: #cecece;
  --sun: #fff;
  display: inline-block;
  position: relative;
  border-radius: 5em;
  cursor: pointer;
  width: 60px;
  height: 25px;
  overflow: hidden;
  transition: all .5s;
  
  box-sizing: border-box;
}

.switch-name .back {
  background-color: var(--dark-sky);
  position: absolute;
  width: 100%;
  height: 100%;
  left: 0;
  top: 0;
  transition: .5s ease-in-out;
}

.switch-name .checkbox {
  opacity: 0;
}

.switch-name .checkbox:checked ~ .back {
  background-color: var(--light-sky);
}

.switch-name .checkbox:checked ~ .moon {
  opacity: 0;
}

.switch-name .checkbox:checked ~ .sun {
  transform: translate(35px, -50%) ;
  opacity: 1;
}

.switch-name .moon {
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  height: 80%;
  fill: var(--moon);
  transition: .5s;
  padding-left: 6px;
}

.switch-name .sun {
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  height: 80%;
  fill: var(--sun);
  transition: .5s;
  opacity: 0;
  padding-right: 6px;
}